package CarLease.entity;

public class Truck extends Car {
    //子类属性车厢大小
    private final double trunkSize;

    public Truck(String carId, String model, String color, double price, double displacement, double trunkSize) {
        super(carId, model, color, price, displacement);
        this.trunkSize = trunkSize;
    }

    //Truck类重写父类方法，计算租车费用
    @Override
    public double calculateRent(int day) {
        return day * (1200 + trunkSize * 80);
    }

    //重写父类方法，显示车辆信息
	@Override
    public void showSpecialInfo() {
        System.out.println("车厢大小："+trunkSize);
    }
}
